<template>
  <div class="Fg-tree" :style="newStyle" :loading="loading">
    <el-tree
      v-if="!loading"
      :data="resData"
      :props="props"
      v-bind="$attrs"
      :defaultExpandAll="defaultExpandAll"
    >
      <span slot-scope="{ node,data }" :class="data[props.className]">
        <i v-if="data[props.icon]" :class="data[props.icon]" style="margin-right:5px"></i>
        <span>{{ node.label }}</span>
      </span>
    </el-tree>
  </div>
</template>

<script>
import { comMixin } from "../../../utils/comMixins";
export default {
  mixins: [comMixin],
  name: "form-tree",
  props: {
    modelValue: {
      type: Array,
      default: () => [],
    },
    defaultExpandAll: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    defaultExpandAll(newValue) {
      this.loading = true;
      this.$nextTick(() => {
        this.loading = false;
      });
    },
  },
  methods: {},
  computed: {},
};
</script>

<style lang="scss" scoped>
</style>
